package com.xtedu.examproject.dao.base;

import com.xtedu.examproject.entity.ExamQuestion;
import com.xtedu.examproject.util.PageHelper;

import java.util.List;
import java.util.Map;

public interface ExamQuestionDao extends BaseDao<ExamQuestion> {
    // 根据题型查询
    PageHelper<ExamQuestion> findPageByType(int questionTypeId, int pageIndex, int pageSize);

    // 根据课程查询
    PageHelper<ExamQuestion> findPageByCourse(int courseId, int pageIndex, int pageSize);

    // 根据学科查询
    PageHelper<ExamQuestion> findPageBySubject(int subjectId, int pageIndex, int pageSize);

    // 批量插入
    int[] insertBatch(List<Map<String, Object>> questions);

    // 随机获取指定数量的题目
    List<ExamQuestion> randomQuestions(int courseId, int questionTypeId, int questionCount);

    // 批量删除
    int[] deleteBatch(List<Integer> questionIds);

    // 根据id查询此题是否在未开考状态考试的试卷中
    Boolean isNotInEndExam(int questionId);
//    List<ExamQuestion> randomQuestions(int courseId,int questionTypeId, int questionCount);

    public List<Map<String, Object>> getQuestionTypeStats() throws Exception;
    public PageHelper<ExamQuestion> findPageByCourseAndType(Integer courseId, Integer questionTypeId, int pageIndex, int pageSize);

    /**
     * 搜索题目
     */
    PageHelper<ExamQuestion> searchQuestions(Integer courseId, Integer questionTypeId, String searchText, int pageIndex, int pageSize);

}
